package Eyjafjalla.card.dolly;

import Eyjafjalla.action.EyjafjallaAttackAction;
import Eyjafjalla.card.AbstractEyjafjallaCard;
import Eyjafjalla.card.attack.Ignition_Eyjafjalla;
import Eyjafjalla.card.attack.ReIgnition_Eyjafjalla;
import Eyjafjalla.modcore.ColorEnum;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInHandAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.VulnerablePower;

public class CPS_Eyjafjalla extends AbstractEyjafjallaCard {
    public static final String ID = "CPS_Eyjafjalla";
    private static final CardStrings cardStrings;

    boolean extraDamage = false;

    public CPS_Eyjafjalla(){
        super(ID, cardStrings.NAME,1,cardStrings.DESCRIPTION,CardType.ATTACK, ColorEnum.Eyjafjalla_Dolly_COLOR,CardRarity.COMMON,CardTarget.ENEMY);
        this.baseDamage = 7;
        this.damage =7;
        setDolly();
        setFireDescription(cardStrings.EXTENDED_DESCRIPTION[0]);
    }

    @Override
    public AbstractCard makeCopy() {
        return new CPS_Eyjafjalla();
    }

    @Override
    public void calculateCardDamage(AbstractMonster mo) {
        super.calculateCardDamage(mo);
        extraDamage = (mo!=null&&mo.getIntentBaseDmg()>=0);
    }

    @Override
    public void applyPowers() {
        super.applyPowers();
        extraDamage = false;
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        addToBot(new EyjafjallaAttackAction());
        addToBot(new DamageAction(m,new DamageInfo(p,damage,damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_VERTICAL));
        if(extraDamage){
            addToBot(new DamageAction(m,new DamageInfo(p,damage,damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_HORIZONTAL));
        }
        if(isFire()){
            addToBot(new DamageAction(m,new DamageInfo(p,damage,damageTypeForTurn), AbstractGameAction.AttackEffect.FIRE));
        }
    }

    @Override
    public void upgrade() {
        if(!this.upgraded){
            upgradeName();
            upgradeDamage(4);
        }
    }

    static {
        cardStrings = CardCrawlGame.languagePack.getCardStrings(ID);
    }
}


